package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.servlet.ServletUtilities;
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.general.DatasetUtilities;


public class ZhuxingtuServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	String p1 = req.getParameter("p1");
	String p2 = req.getParameter("p2");
	String p4 = req.getParameter("p4");
	
	
	
	String[] s1=p1.split("-");
	String[] s2=p2.split("-");
	String[] s4=p4.split("-");

	if(s1[1].equals(s2[1])||s2[1].equals(s4[1])||s4[1].equals(s1[1])||s1[1].equals(s4[1])||s4[1].equals(s2[1])){
		
		
		req.getRequestDispatcher("/jsp/zhuxingtu.jsp").forward(req, resp);
		
	}else{
		req.setAttribute("p1", p1);	
		req.setAttribute("p2", p2);	
		req.setAttribute("p4", p4);	
		req.setAttribute("s1", s1);
		req.setAttribute("s2", s2);	
		req.setAttribute("s4", s4);

	req.getRequestDispatcher("/jsp/zhuxingtu.jsp").forward(req, resp);
	
	}

}
@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
	      doGet(req, resp);
	}
}
